package com.kl.forum.service;

import com.kl.forum.dao.CircleCommentLightMapper;
import com.kl.forum.entity.CircleCommentLight;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@Service
public class CircleCommentLightService {
    @Autowired
    private CircleCommentLightMapper lightMapper;

    public int insert(Integer commentId,Integer userId){
        CircleCommentLight light=new CircleCommentLight();
        light.setCommentId(commentId);
        light.setUserId(userId);
        light.setStatus(1);
        light.setCreateTime(new Date());
        return lightMapper.insertSelective(light);
    }
    public  int update(CircleCommentLight light){
        return lightMapper.updateByPrimaryKey(light);
    }


    public CircleCommentLight findOneCircleCommentLight(Integer commentId, Integer userId) {
            Map map=new HashMap();
            map.put("commentId",commentId);
            map.put("userId",userId);
            return lightMapper.findOneCircleCommentLight(map);
        }
}
